package com.example.rpapp.assembler;


import com.example.rpclient.dto.ActivityRuleAddCmd;
import com.example.rpclient.dto.data.ActivityRuleVo;
import com.example.rpdomain.activityrule.ActivityRuleEntity;

import java.time.LocalDateTime;

public class ActivityRuleAssembler {
    public static ActivityRuleEntity toAddEntity(ActivityRuleAddCmd cmd) {
        ActivityRuleEntity activityRuleEntity = new ActivityRuleEntity();
        activityRuleEntity.setActivityId(cmd.getActivityId());
        activityRuleEntity.setRuleId(cmd.getRuleId());
        activityRuleEntity.setCreateTime(LocalDateTime.now());
        activityRuleEntity.setCreator("大帅哥");
        activityRuleEntity.setUpdateTime(LocalDateTime.now());
        activityRuleEntity.setUpdater("大帅哥");

        return activityRuleEntity;
    }

    public static ActivityRuleVo toActivityRuleVO(ActivityRuleEntity entity) {
        ActivityRuleVo activityRuleVo = new ActivityRuleVo();
        activityRuleVo.setId(entity.getId());
        activityRuleVo.setActivityId(entity.getActivityId());
        activityRuleVo.setRuleId(entity.getRuleId());
        activityRuleVo.setCreateTime(entity.getCreateTime());
        activityRuleVo.setCreator("大帅哥");
        activityRuleVo.setUpdateTime(entity.getUpdateTime());
        activityRuleVo.setUpdater("大帅哥");

        return activityRuleVo;
    }
}
